﻿using System.Windows.Forms;

namespace Outlook.WorkItems.Extension.Controls
{
    public class FolderNode : TreeNode
    {
        public FolderNode(string text, string path)
            : base(text)
        {
            Tag = path;
            Name = text;
            ImageIndex = 4;
            SelectedImageIndex = 4;
        }

        public FolderNode(string text)
        {
            
        }
        public TeamServerNode TeamServerNode
        {
            get
            {
                TreeNode currentNode = this;
                while (!(currentNode is TeamServerNode) && currentNode != null)
                {
                    currentNode = currentNode.Parent;
                }
                return currentNode as TeamServerNode;
            }
        }

        public DocumentLibrairyNode DocumentLibrairyNode
        {
            get
            {
                TreeNode currentNode = this;
                while (!(currentNode is DocumentLibrairyNode) && currentNode != null)
                {
                    currentNode = currentNode.Parent;
                }
                return currentNode as DocumentLibrairyNode;
            }
        }

        public TeamProjectNode TeamProjectNode
        {
            get
            {
                TreeNode currentNode = this;
                while (!(currentNode is TeamProjectNode) && currentNode != null)
                {
                    currentNode = currentNode.Parent;
                }
                return currentNode as TeamProjectNode;
            }
        }
    }
}
